package com.xhblogs.book.mapper;

import com.xhblogs.book.pojo.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface BookMapper {
    /**
     * 查询所有
     * @return
     */
    List<Map<String,Object>> getAll();

    /**
     * 根据名称模糊查询
     * @return
     */
    List<Map<String,Object>> getLike(@Param("name") String name);

    List<Map<String,Object>> getCategoryIdBooks(@Param("id") int id);
    Book getIdBook(@Param("id") int id);
    /**
     * 更新book
     * @param book
     * @return
     */
    int updateBook(Book book);

    /**
     * 添加图书
     * @param book
     * @return
     */
    int addBook(Book book);

    /**
     * 修改图书根据id
     * @param id
     * @return
     */
    int delectBook(@Param("id") int id);

}
